package com.cssl.service.impl;

import com.cssl.dao.CartsDao;
import com.cssl.pojo.Carts;
import com.cssl.service.CartsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CartsServiceImpl implements CartsService {
    @Autowired
    private CartsDao cartsDao;
    @Override
    public Boolean addToCart(Integer uid, Integer gid) {
        int i = cartsDao.addToCart(uid,gid);
        if(i>0){
            return true;
        }else{
            return false;
        }
    }

    @Override
    public Boolean checkCarts(Integer uid, Integer gid) {
        Carts carts = cartsDao.checkCarts(uid,gid);
        return carts == null;
    }

    @Override
    public Integer addToCart2(Integer uid, Integer gid) {
        return cartsDao.addToCart2(uid,gid);
    }
}
